package ace.cmp.data.methodname.method.name.sql.core.enums;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author Caspar sql 操作关键字
 */
@AllArgsConstructor
public enum SqlCommandTypeEnum {
  SELECT("select", "select", Arrays.asList("select", "read", "get", "search", "query", "find")),
  COUNT("count", "count", Arrays.asList("count")),
  EXISTS("exists", "exists", Arrays.asList("exists")),
  DELETE("delete", "delete", Arrays.asList("delete", "remove")),
  ;
  @Getter private String code;
  @Getter private String desc;
  @Getter private List<String> keywords;

  public static List<String> getAllKeyWords() {
    return Arrays.stream(SqlCommandTypeEnum.values())
        .map(p -> p.getKeywords())
        .flatMap(List::stream)
        .collect(Collectors.toList());
  }
}
